using System;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp;
using CKY.AgentPlatform.Users.Dtos;

namespace CKY.AgentPlatform.Users
{
    /// <summary>
    /// 用户认证应用服务接口
    /// </summary>
    [RemoteService(IsEnabled = true)]
    public interface IUserAuthAppService : IApplicationService
    {
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="input">登录参数</param>
        /// <returns>认证结果</returns>
        Task<UserAuthResultDto> LoginAsync(UserLoginDto input);

        /// <summary>
        /// 用户注册
        /// </summary>
        /// <param name="input">注册参数</param>
        /// <returns>注册结果</returns>
        Task<UserAuthResultDto> RegisterAsync(UserRegisterDto input);

        /// <summary>
        /// 用户登出
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>登出结果</returns>
        Task<bool> LogoutAsync(Guid userId);

        /// <summary>
        /// 刷新访问令牌
        /// </summary>
        /// <param name="input">刷新令牌参数</param>
        /// <returns>新的认证结果</returns>
        Task<UserAuthResultDto> RefreshTokenAsync(RefreshTokenDto input);

        /// <summary>
        /// 获取当前用户信息
        /// </summary>
        /// <returns>用户信息</returns>
        Task<UserInfoDto> GetCurrentUserAsync();

        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="input">修改密码参数</param>
        /// <returns>修改结果</returns>
        Task<bool> ChangePasswordAsync(ChangePasswordDto input);

        /// <summary>
        /// 忘记密码
        /// </summary>
        /// <param name="input">忘记密码参数</param>
        /// <returns>发送重置邮件结果</returns>
        Task<bool> ForgotPasswordAsync(ForgotPasswordDto input);

        /// <summary>
        /// 重置密码
        /// </summary>
        /// <param name="input">重置密码参数</param>
        /// <returns>重置结果</returns>
        Task<bool> ResetPasswordAsync(ResetPasswordDto input);

        /// <summary>
        /// 验证用户权限
        /// </summary>
        /// <param name="permission">权限名称</param>
        /// <returns>是否有权限</returns>
        Task<bool> HasPermissionAsync(string permission);

        /// <summary>
        /// 验证用户角色
        /// </summary>
        /// <param name="role">角色名称</param>
        /// <returns>是否有角色</returns>
        Task<bool> IsInRoleAsync(string role);

        /// <summary>
        /// 启用双因子认证
        /// </summary>
        /// <returns>启用结果</returns>
        Task<bool> EnableTwoFactorAuthAsync();

        /// <summary>
        /// 禁用双因子认证
        /// </summary>
        /// <returns>禁用结果</returns>
        Task<bool> DisableTwoFactorAuthAsync();

        /// <summary>
        /// 验证双因子认证码
        /// </summary>
        /// <param name="code">验证码</param>
        /// <returns>验证结果</returns>
        Task<bool> VerifyTwoFactorCodeAsync(string code);

        /// <summary>
        /// 确认邮箱
        /// </summary>
        /// <param name="token">确认令牌</param>
        /// <returns>确认结果</returns>
        Task<bool> ConfirmEmailAsync(string token);

        /// <summary>
        /// 重新发送邮箱确认邮件
        /// </summary>
        /// <returns>发送结果</returns>
        Task<bool> ResendEmailConfirmationAsync();

        /// <summary>
        /// 确认电话号码
        /// </summary>
        /// <param name="code">验证码</param>
        /// <returns>确认结果</returns>
        Task<bool> ConfirmPhoneNumberAsync(string code);

        /// <summary>
        /// 发送电话验证码
        /// </summary>
        /// <returns>发送结果</returns>
        Task<bool> SendPhoneNumberVerificationAsync();
    }
}